﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>前台分页</title>
    <link href="../../../../Scripts/easyUI145/themes/icon.css" rel="stylesheet" type="text/css" />
    <link href="../../../../Scripts/easyUI145/themes/default/easyui.css" rel="stylesheet" type="text/css" />

    <link href="../../../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <link href="../../../../Scripts/layui/layui/css/layui.css" rel="stylesheet" />
    <script src="../../../../Scripts/jquery-1.11.0.min.js" type="text/javascript"></script>
    <script src="../../../../Scripts/layui/layui/layui.js" type="text/javascript"></script>
    <script src="../../../../Scripts/layui/LayuiDialog.js" type="text/javascript"></script>

    <script src="../../../../Scripts/QueryString.js" type="text/javascript"></script>
    <script src="../../../../Scripts/config.js" type="text/javascript"></script>
    <script src="../../../../Scripts/QueryString.js" type="text/javascript"></script>
    <script src="../../../../Comm/Gener.js" type="text/javascript"></script>
    <script src="DDLBar.js" type="text/javascript"></script>
    <link href="../../../../Style/skin/adminfont/iconfont.css" rel="stylesheet" />
    <link href="../../../../Style/skin/css/Default.css" rel="stylesheet" />

    <script type="text/javascript">
        $(function () {

            InitBar(0);

            var frmID = GetQueryString("FrmID");

            var dblist = new Entity("BP.CCBill.DBList", frmID);

            dblist.ExpList = dblist.ExpEn.replace('~', '\'');
            dblist.ExpList = dblist.ExpEn.replace('~', '\'');

            $("#TB_DBSrc").val(dblist.ExpList);
            $("#TB_MainTable").val(dblist.MainTable);
            $("#TB_MainTablePK").val(dblist.MainTablePK);

        });

        function GetDataType(datatype) {
            if (datatype == 1) return "String";
            if (datatype == 2) return "Int";
            if (datatype == 3) return "Float";
            if (datatype == 4) return "Boolean";
            if (datatype == 5) return "Double";
            if (datatype == 6) return "Date";
            if (datatype == 7) return "DateTime";
            if (datatype == 8) return "Money";
        }
        /**
         * 获取数据结构
         */
        function Save() {
            var frmID = GetQueryString("FrmID");
            var dblist = new Entity("BP.CCBill.DBList", frmID);
            dblist.ExpList = $("#TB_DBSrc").val();

            dblist.MainTable = $("#TB_MainTable").val();
            dblist.MainTablePK = $("#TB_MainTablePK").val();

            if (dblist.ExpList.indexOf('@Key') == -1) {
                alert("数据源里必须包含@Key参数.");
                return;
            }

            dblist.Update();
            Reload();
        }
        /**
         *修改字段名称、保存应用
         */
        function App() {

            var handler = new HttpHandler("BP.CCBill.WF_CCBill_Admin_DBList");
            handler.AddUrlData();
            handler.AddFormData();
            var data = handler.DoMethodReturnString("FieldsORM_App");
            alert(data);
            Reload();
        }
        function ViewFrm() {
            var frmID = GetQueryString("FrmID");
            //http://localhost:2296/WF/CCForm/FrmGener.htm?1=2&t=0.7413469328474454&FrmID=Dict_XueShengTaiZhang&FK_MapData=Dict_XueShengTaiZhang
            var url = "../../../CCForm/FrmGener.htm?FrmID=" + frmID + "&FK_MapData=" + frmID;
            window.open(url);
        }
    </script>
</head>
<body>
    <div id="bar">
    </div>
    <form id="cc">
        <fieldset>
            数据源：
            <select id="DDL_DBSrc" name="DDL_DBSrc"></select>

            <legend>列表数据源: 必须有：OID,BillNo,Title 字段.</legend>
            <textarea value="" id="TB_DBSrc" name="TB_DBSrc"> </textarea>
            数据源主表：
            <input type="text" id="TB_MainTable" value="" />
            数据源主键盘：
            <input type="text" id="TB_MainTablePK" value="" />

            <br />
            <input type="button" value="保存并检查" id="Btn_Save" onclick="Save()" />

            <!--<div id="docs"></div>
            <input type="button" value="保存字段名并提交应用" id="Btn_App" onclick="App()" />
            <input type="button" value="表单预览" id="Btn_ViewFrm" onclick="ViewFrm()" />-->

            <legend>
                说明：
            </legend>
            <ul>

                <li> 单笔记录数据源也叫实体数据源，他是列表可以看到的数据源。 </li>
                <li> 表达式里必须有一个@Key参数，就是主键。 </li>

                <li> 只有提交应用才能生效 </li>

                <li> 如果字段类型不匹配，请打开字段属性，进行编辑，然后把string类型的转化为其他类型. </li>

                <li>
                    SELECT A.No as OID, A.No as BillNo, a.Name AS Title, A.Tel, A.PinYin,A.Email , B.No as Dept, B.Name AS DeptT
                    FROM Port_Emp A, Port_Dept B WHERE A.FK_Dept=B.No AND A.No='@Key'
                </li>

            </ul>

        </fieldset>
    </form>

</body>
</html>
